/*
Contains all of the definitions used by everything.
*/

//Character Constants
#define MAX_CHARS	4

//Other Constants
#define SAVEFILE_VERSION 3
#define ROOT_NEGATIVE   -7
#define MAX_LEVEL		20

//Armor/Book restrictions
#define LIGHTMAG	(1 << 1)
#define DARKMAG		(1 << 2)
#define MAGICAL		(1 << 3)
#define SUPPORT		(1 << 4)
#define RESTORE		(1 << 5)
#define RANGED		(1 << 6)

//Armor/Book restrictions
#define ALL 		RANGED|RESTORE|SUPPORT|MAGICAL|DARKMAG|LIGHTMAG
#define ALLDARK		RANGED|RESTORE|SUPPORT|MAGICAL|DARKMAG
#define ALLLIGHT	RANGED|RESTORE|SUPPORT|MAGICAL|		   LIGHTMAG
#define ALLRANGE	RANGED|						   DARKMAG|LIGHTMAG
#define ALLRESTORE		   RESTORE|				   DARKMAG|LIGHTMAG
#define ALLSUPPORT				   SUPPORT|		   DARKMAG|LIGHTMAG
#define ALLMAGICAL						   MAGICAL|DARKMAG|LIGHTMAG
#define ALLTOPTIER								   DARKMAG|LIGHTMAG
#define ONLY_DARK								   DARKMAG
#define ONLY_LIGHT										   LIGHTMAG

//Spell elements
#define FIRE 		(1 << 7)
#define WATER 		(1 << 8)
#define EARTH		(1 << 9)
#define WIND		(1 << 10)
#define ELECTRIC	(1 << 11)
#define HOLY		(1 << 12)
#define DARK		(1 << 13)
#define NEUTRAL		(1 << 14)
#define HEALING		(1 << 15)

//Bonuses for components
#define RANGE 		128
#define POWER 		256
#define SPEED 		512
#define SUSTAIN 	1024

//Shorter declarations
#define BOOK equipment["Book"]
#define BODY equipment["Body"]

//Macros
#define isnegative(x) (x>0)

#define isroot(x) istype(x,/root)
#define isplayer(x) istype(x,/player)
#define ismonster(x) istype(x,/monster)
#define ishotkey(x) istype(x,/hotkey)

#define isbook(x) istype(x,/book)
#define isarmor(x) istype(x,/armor)
#define isspell(x) istype(x,/spell)

#define islist(x) istype(x,/list)
#define isclient(c) istype(c,/client)
#define ispriest(p) istype(p,/npc/priests)

//Max spell tier -- used when calculating average tier
#define MAX_TIER 	3

//A percentage that is used when calculating weaknesses/strengths
//#define BIT_MAX		127
#define BIT_MAX		100

//Mob alliances
#define PLAYER		1
#define MONSTER		2
#define NEITHER		4
#define TOWNSPERSON 8
#define FRIEND_MON	16

//Monster roles
#define MELEE		1
#define ARCHER		2
#define HEALER		4

//Monster states
#define NORMAL		1
#define FLEE		2
#define HIDE		3
#define HAPPY		4
#define ANGRY		5
#define CALM		6

//Global constants
#define SPAWN_DELAY	600

//Tooltip constants/macros
#define TOOLTIP_DELAY 4
#define TOOLTIP_BOX_SIZE 10
#define MAX_TOOLTIPS 1
#define in_range(x, y) (x > y-TOOLTIP_BOX_SIZE && x < y+TOOLTIP_BOX_SIZE)

//Area constants
#define NOMAGIC 1
#define NOMONSTER 2


#ifdef DEBUG

#define FILE __FILE__
#define LINE __LINE__
proc/debug(string, file, line)
	Log("[file][line ? ":[line]" : ""] - [string]")

proc/Log(string)
	text2file(string, "log.txt")
#endif